package shared;

import java.io.Serializable;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

public class User implements Serializable
{

    /**
     * 
     */
    private static final long serialVersionUID = 1111L;

    private String username;

    private String password;

    private String firstname;

    private String lastname;

    private String email;

    private ArrayList<Long> myFileIDs;
    
    public HashMap<String, FileDescriptor> myFiles;

    private ArrayList<ShareInvite> myInvites;

    public String getUsername()
    {
	return username;
    }

    public void setUsername(String username)
    {
	this.username = username;
    }

    public String getPassword()
    {
	return password;
    }

    public void setPassword(String password)
    {
	this.password = password;
    }

    public String getFirstname()
    {
	return firstname;
    }

    public void setFirstname(String firstname)
    {
	this.firstname = firstname;
    }

    public String getLastname()
    {
	return lastname;
    }

    public void setLastname(String lastname)
    {
	this.lastname = lastname;
    }

    public String getEmail()
    {
	return email;
    }

    public void setEmail(String email)
    {
	this.email = email;
    }

    public ArrayList<Long> getMyFileIDs()
    {
	return myFileIDs;
    }

    public void setMyFileIDs(ArrayList<Long> myFileIDs)
    {
	this.myFileIDs = myFileIDs;
    }

    public HashMap<String, FileDescriptor> getMyFiles()
    {
	return myFiles;
    }

    public void setMyFiles(HashMap<String, FileDescriptor> myFiles)
    {
	this.myFiles = myFiles;
    }

    public ArrayList<ShareInvite> getMyInvites()
    {
	return myInvites;
    }

    public void setMyInvites(ArrayList<ShareInvite> myInvites)
    {
	this.myInvites = myInvites;
    }
    
 
    public void populate(HashMap<Long, FileDescriptor> files)
	    throws RemoteException
    {
	if (files == null)
	    throw new CloudException("MasterServer file list error!");

	this.myFiles = new HashMap<String, FileDescriptor>();
	
	for (Long i : this.myFileIDs)
	{
	    FileDescriptor newFile = files.get(i);
	    this.myFiles.put(newFile.getPathname(), newFile);
	}
	

    }



}
